package design_pattern.observer;

/**
 * Created by WeiDingKuo on 2017/10/26 20:25
 * <p>
 * 观察者
 */
public class ObserverImpl1 implements Observer {
    //保存被观察者引用
    private Subject subject;

    public ObserverImpl1(Subject subject) {
        this.subject = subject;
        this.subject.registerObserver(this);
    }

    @Override
    public void dosomething() {
        System.out.println(this.getClass().getName() + " : do something");
    }
}
